package com.mikelouis.test.scala.proginscala.chapter8

import scala.io.Source

/**
 * Created by yuazhu on 1/2/2015.
 */
object LongLines {

  def processFile(filename: String, width: Int): Unit = {
    val source = Source.fromFile(filename)
    for (line <- source.getLines())
      processLine(filename, width, line)
  }

  def processLine(filename: String, width: Int, line: String) = {
    if (line.length > width)
      println(filename + ": " + line.trim)
  }

  def main(args: Array[String]) {
    processFile("build.sbt", 23)
  }
}
